package com.mazaiting.manager;

import com.dtp.core.spring.EnableDynamicTp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;

/**
 * Apollo 应用入口
 * ComponentScan->basePackages添加扫描权限认证包
 * nacos 发现服务
 *
 * 1. 解决 Unable to make field private volatile java.util.concurrent.ThreadFactory java.util.concurrent.ThreadPoolExecutor.threadFactory accessible: module java.base does not "opens java.util.concurrent" to unnamed module @3c41ed1d
 *      启动时需要添加 VM 参数: --add-opens java.base/java.util.concurrent=ALL-UNNAMED
 *
 * - 启动参数
 *    --add-opens java.base/java.util.concurrent=ALL-UNNAMED
 *
 * @author mazaiting
 * @create_time 2022/3/18 23:08
 */
// 启用动态线程池
@EnableDynamicTp
// 激活缓存
@EnableCaching
// 激活服务注册
@EnableDiscoveryClient
@EnableConfigurationProperties
@SpringBootApplication
//@ComponentScan(basePackages = {
//        "com.mazaiting.manager",
//        "com.mazaiting.common",
//        "com.mazaiting.mybatisplus",
//        "com.mazaiting.rabbitmq",
//        "com.mazaiting.scheduler",
//        "com.mazaiting.redisson",
//        "com.mazaiting.redis",
//})
@ComponentScan(basePackages = "com.mazaiting")
@ServletComponentScan(basePackages = "com.mazaiting")
public class ApolloManagerApplication {

    public static void main(String[] args) {
        try {
            SpringApplication.run(ApolloManagerApplication.class, args);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

